home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / GoldED Tools / Macro Collection / Oberon / run.ged < prev    next >
Encoding:
Text File  |  1996-09-27  |  1.7 KB  |  72 lines

  1. /*
  2. ** $VER: run 0.003 (18 Oct 1994) ***
  3. **
  4. ** (c) © 1994 Oliver Clouth
  5. **
  6. ** Function : run
  7. **
  8. **
  9. */
  10.  
  11.  
  12. OPTIONS RESULTS                             /* enable return codes     */
  13.  
  14. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  15.     address 'GOLDED.1'
  16.  
  17. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  18. OPTIONS FAILAT 6                            /* ignore warnings         */
  19. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  20.  
  21. host = ADDRESS()                              /* get GED's port    */
  22.  
  23. /* ------------------------- INSERT YOUR CODE HERE: ------------------ */
  24.  
  25.  
  26. 'QUERY CAT'
  27. isGerman = (result = "deutsch")
  28.  
  29. 'QUERY ANYTEXT'
  30.  
  31. if (result = 'TRUE') then 
  32.  
  33.     do
  34.         'QUERY DOC VAR OLDNAME'             /* remember current file name */
  35.         
  36.         'QUERY PATH Var PFAD'
  37.         'QUERY FILE VAR FNAME'              /* Nur den Filenamen in Var FNAME */
  38.        
  39.              Name = left(FNAME, Pos('.', FNAME) - 1)
  40.          InfoName = PFAD || '/' || Name
  41.  
  42.         call pragma 'D', PFAD         /* Aktuelles Verzeichnis wechseln */
  43.         call pragma 'Stack', 10000
  44.         
  45.        /*
  46.         shell                               /* address shell */
  47.  
  48.         ok = (RC = 0)
  49.  
  50.         shell                               /* address host (GoldED) */
  51.        */
  52.         'NAME NEW ' || oldname              /* restore old file name */
  53.  
  54.         'QUERY CON VAR CON'
  55.         shell
  56.         Name
  57.         /* '>' || CON */
  58.         shell
  59.     end
  60.  
  61. ELSE 
  62. do
  63.  
  64.     if (isGerman) then
  65.         'REQUEST BODY="Kein Text vorhanden ?!"'
  66.     else
  67.         'REQUEST BODY="Text buffer is empty ?!"'
  68. end
  69.  
  70. 'UNLOCK' /* VERY important: unlock GUI */
  71. Exit
  72.